﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using Antu.WebControls;
using Antu.Core.Components;
using Antu.Core.Services;
using System.Web.UI.WebControls;
using EluZSProvider;
using System.Web;
using System.Web.UI.HtmlControls;
using System.Data;

namespace WebSys.UI.Control.ZhengShou
{
    public class ZhengSFWLogControl : MPBasicTemplate
    {
        EluZSDataProvider _EluZSDataProvider = (EluZSDataProvider)ProviderService.ProviderServiceMange.GetProvider("EluZSProvider");
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            Bind();
        }

        protected void Bind()
        {
            CustomGridView CustomGridView1 = (CustomGridView)FindControl("CustomGridView1");
            Button btnSeach = (Button)FindControl("btnSeach");
            Button button1 = (Button)FindControl("Button1");
            TextBox txtProName = (TextBox)FindControl("txtProName");
            TextBox txtProUName = (TextBox)FindControl("txtProUName");
            string proName = txtProName.Text;
            string userName = txtProUName.Text;
            DataTable dt = _EluZSDataProvider.GetFANWEILOG(HttpContext.Current.Request["PID"], proName, userName);
            CustomGridView1.DataSource = dt;
            CustomGridView1.RecordCount = dt.Rows.Count;
            CustomGridView1.DataBind();

            btnSeach.Click += new EventHandler(btnSeach_Click);
            button1.Click += new EventHandler(button1_Click);
            CustomGridView1.OnLoadData += new EventHandler(CustomGridView1_OnLoadData);
        }
        protected void btnSeach_Click(object sender, EventArgs e)
        {
            Bind();
        }
        protected void CustomGridView1_OnLoadData(object sender, EventArgs e)
        {
            Bind();
        }
        protected void button1_Click(object sender, EventArgs e)
        {
            string strType = HttpContext.Current.Request["type"];
            if (strType == "0")
            {
                HttpContext.Current.Response.Redirect("EditProject.aspx?PID=" + HttpContext.Current.Request["PID"] + "&action=edit&query=project");
            }
            if (strType == "1")
            {
                HttpContext.Current.Response.Redirect("EditProjectFW.aspx?PID=" + HttpContext.Current.Request["PID"] + "&action=edit&query=dongjie");
            }
            if (strType == "2")
            {
                HttpContext.Current.Response.Redirect("ZS_BCFAInfo.aspx?PID=" + HttpContext.Current.Request["PID"] + "&ifafter=0&zt=" + HttpContext.Current.Request["zt"]);
            }
            if (strType == "3")
            {
                HttpContext.Current.Response.Redirect("ZS_BCFAInfo.aspx?PID=" + HttpContext.Current.Request["PID"] + "&ifafter=1&zt=" + HttpContext.Current.Request["zt"]);
            }
            if (strType == "4")
            {
                HttpContext.Current.Response.Redirect("EditZhengShouXuke.aspx?ID=" + HttpContext.Current.Request["ID"] + "&PID=" + HttpContext.Current.Request["PID"] + "&action=edit&zt=" + HttpContext.Current.Request["zt"]);
            }
        }
    }
}


